#include "main/utils.h"
using namespace std;

int countPalindromeCore(string str, int begin, int end) {
  int length = str.size();
  int count = 0;
  while (begin >= 0 && end < length) {
    if (str[begin] == str[end]) {
      --begin;
      ++end;
      ++count;
    } else {
      break;
    }
  }
  return count;
}

int countPalindrome(string str) {
  int count = 0;
  for (int i = 0; i < str.size(); ++i) {
    count += countPalindromeCore(str, i, i);
    count += countPalindromeCore(str, i, i + 1);
  }
  return count;
}

int main() {
  string str = "aaa";
  int ret = countPalindrome(str);
  cout << ret << endl;

  str = "abc";
  ret = countPalindrome(str);
  cout << ret << endl;

  return 0;
}
